<?php
namespace app\common\model;
class Taskoptions extends Base{
    /**
     * 通过event、action获取配置中的 任务名称分类
     * @var $event
     * @var $action
     */
    function getTaskEvent($event=null,$action=null){
        if(is_null($event)||is_null($action)){
            return [];
        }
        $group=model('taskgroup')->read(['event'=>$event,'status'=>1],'id,title');
        if(empty($group)){
            return [];
        }
        $nav=$this->read(['action'=>$action,'group_id'=>$group['id'],'status'=>1],'id,title,type');
        if(empty($nav)){
            return [];
        }
        return [
            'group'=>$group['title'],
            'nav'=>$nav['title'],
            'type'=>$nav['type'],
            'remark'=>'（'.$group['title'].'）'.$nav['title'],
        ];
    }
}
